<div class="bjui-pageHeader">
    <div class="pull-right">
        <button class="btn-default" data-icon="plus" title="增加分类" data-toggle="tooltip" data-placement="left" onclick="createDialog('{:U("Forms/art_type")}', '新增文章分类', 'art_type', {width:700, height:450})" ></button>
        <button class="btn-default" data-icon="refresh" onclick="$.CurrentNavtab.navtab('refresh')"></button>
    </div>
    <form id="pagerForm" data-toggle="ajaxsearch" data-loadingmask="true" action="{:U('Index/save')}" method="post">
        <input type="hidden" name="pageSize" value="{:I('param.pageSize')}" />
        <input type="hidden" name="pageCurrent" value="{:I('param.pageCurrent')}" />
        <input type="hidden" name="orderField" value="{:I('param.orderField')}" />
        <input type="hidden" name="orderDirection" value="{:I('param.orderDirection')}" />
    </form>
</div>
<div class="bjui-pageContent tableContent">
    <table class="table table-bordered table-hover table-striped table-top groyTable" data-selected-multi="false">
        <thead>
        <tr>
            <th>分类名称</th>
            <th width="">添加时间</th>
            <th width="60">状态</th>
            <th width="36">权重</th>
            <th width="100">操作</th>
        </tr>
        </thead>
        <tbody>
        <!--
            tr  class == groy1 是一级分类. groy2二级 开关事件,注意span.groys  和子元素的data-icon   plus && minus
        -->
        <volist name="list" id="vo">
        <tr class="groy{$vo.leve}">
	        <if condition="$vo.leve eq '1'">
	            <td><span class="groys"> <button class="btn-green btn-xs" data-icon="plus"></button>{$vo.name}</span></td>
	        <else/>
	            <td style="padding-left: 8em;"><span class="groys"> {$vo.name}</span></td>
	        </if>
            <td>{$vo.add_time}</td>
            <if condition="$vo.status eq '0'">
            <td><a href="{:U('Forms/update_class_article',array('id'=>$vo['id']))}" data-type="get" data-toggle="doajax" data-confirm-msg="要隐藏这个分类?">显示</a></td>
            <else/>
            <td><a href="{:U('Forms/update_class_article',array('id'=>$vo['id']))}" data-type="get" data-toggle="doajax" data-confirm-msg="要显示这个分类?">已关闭</a></td>
            </if>
            <td>{$vo.sort}</td>
            <td>
                <button type="button" class="btn-green" onclick="createDialog('{:U("Forms/art_type",array("id"=>$vo["id"]))}', '新增文章分类', 'art_type', {width:700, height:450})">改</button>
                <a href="{:U('Forms/del_class_article',array('id'=>$vo['id']))}" data-type="get" class="btn btn-red" data-toggle="doajax" data-confirm-msg="要删除这个分类?">删</a>
            </td>
        </tr>
        </volist>
        </tbody>
    </table>
</div>
<script>
    $(function () {
        $('.groys').click(function () {
            var par = $(this).parents('tr');
            var flag = $(this).find('i.fa').hasClass('fa-plus');
            flag ? ($(this).find('i.fa').addClass('fa-minus').removeClass('fa-plus')) : ($(this).find('i.fa').addClass('fa-plus').removeClass('fa-minus'));
            var cls = par.hasClass('groy2');
            par.nextAll('tr').each(function() {
                if( $(this).hasClass('groy1') ) {
                    return false;
                }else{
                    if( !cls ){
                        $(this).hasClass('groy2') && ($(this).find('span.groys i.fa').addClass('fa-minus').removeClass('fa-plus'));
                        flag ? ($(this).show()) : ($(this).hide());
                    }else{
                        $(this).toggle();
                    }

                }
            });
        });
    });

</script>
<include file="Common/footer" ftype="page" />